
$(document).ready(function(){
    /*******************/
    //

    $("#UpdateCredit").live("click",function(){
        var id = $("#creditInput").attr('content');
        var creditValue = $("#creditInput").val();
        $("#addingProduct").fadeIn(100);
        $.ajax(
        {
            url:'inc/updateUserProfile.php',
            data:"userID="+id+"&type=credit"+"&credit="+creditValue,
            type: 'post',
            success: function(j){
                $("#addingProduct").fadeOut(1000);
                $("#successAdding").fadeIn(2000);
                $("#successAdding").fadeOut(1000);
            //                $('#userProfileAreaInputCredit').html(j); 
            //                $('#userProfileAreaInputCredit').fadeIn(1000);
            }
        });
    });
    $("#UpdatePassword").live("click",function(){
        var id = $("#passwordInput").attr('content');
        var passwordValue = $("#passwordInput").val();
        $("#addingProduct").fadeIn(100);

        $.ajax(
        {
            url:'inc/updateUserProfile.php',
            data:"userID="+id+"&type=password"+"&password="+passwordValue,
            type: 'post',
            success: function(j){
                $("#addingProduct").fadeOut(1000);
                $("#successAdding").fadeIn(2000);
                $("#successAdding").fadeOut(1000);
            //                $('#userProfileAreaInputPassword').html(j); 
            //                $('#userProfileAreaInputPassword').fadeIn(1000); 
                
            }
        });
    });
    //////////
    //////////
    //ajax get admin option
    $(".adminNav").click(function(){
        var option = $(this).attr('content');
        //        alert(option);
        $(this).removeClass('adminNav');
        $('.selectedAdminNav').addClass('adminNav');
        $('.selectedAdminNav').removeClass('selectedAdminNav');
        $(this).addClass('selectedAdminNav');
        $('#adminOptionArea').hide();
        $.ajax(
        {
            url:'inc/getAdminOption.php',
            data:"option="+option,
            type: 'post',
            success: function(j){
                $('#adminOptionArea').html(j); 
                $('#adminOptionArea').fadeIn(1000); 
                
            }
        });
    });
});
